package com.jzo2o.health.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.jzo2o.api.trade.dto.response.NativePayResDTO;
import com.jzo2o.api.trade.enums.PayChannelEnum;
import com.jzo2o.common.model.PageResult;
import com.jzo2o.health.model.domain.Orders;
import com.jzo2o.health.model.dto.request.OrdersCancelReqDTO;
import com.jzo2o.health.model.dto.request.OrdersPageQueryReqDTO;
import com.jzo2o.health.model.dto.request.PlaceOrderReqDTO;
import com.jzo2o.health.model.dto.response.*;

import java.time.LocalDateTime;
import java.util.List;

/**
 * TODO
 *
 * @Author lyh
 * @Date 2024/12/14 9:44
 */
public interface IOrdersService extends IService<Orders> {
    PlaceOrderResDTO place(PlaceOrderReqDTO placeOrderReqDTO);

    /**
     * 支付
     * @param id
     * @param tradingChannel
     * @return
     */
    OrdersPayResDTO pay(Long id, PayChannelEnum tradingChannel);

    /**
     * 支付后更新订单
     * @param id
     * @param dto
     */
    void updatePay(Long id, NativePayResDTO dto);

    /**
     * 查询支付结果
     * @param id
     * @return
     */
    OrdersPayResDTO payResult(Long id);

    /**
     * 更新查询订单支付结果后的订单
     * @param id
     * @param transactionId
     * @param paySuccessTime
     */
    void paySuccess(Long id, String transactionId, LocalDateTime paySuccessTime);

    /**
     * 取消未支付的订单
     * @param ordersCancelReqDTO
     */
    void cancel(OrdersCancelReqDTO ordersCancelReqDTO);

    /**
     * 未支付订单取消修改订单
     * @param orders
     * @param cancelReason
     * @param b
     */
    void cancelOrdersByNoPay(Orders orders, String cancelReason, boolean b);

    List<OrdersResDTO> pageQuery(Integer ordersStatus, Long sortBy);

    OrdersDetailResDTO detail(Long id);

    PageResult<OrdersResDTO> adminPageQuery(OrdersPageQueryReqDTO ordersPageQueryReqDTO);

    OrdersCountResDTO countByStatus();

    AdminOrdersDetailResDTO aggregation(Long id);
}
